﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BusinessLayer.RegInfo.Entities;
using DBHelper;

namespace BusinessLayer.RegInfo
{
    public class TB_Marketing_Coupon_DetailBL
    {
        public TB_Marketing_Coupon_Detail GetTopCoupon()
        {
            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);
            var list = adapter.GetList<TB_Marketing_Coupon_Detail>("sp_GetTopCoupon", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit);
            return list.FirstOrDefault();
        }

        public TB_Marketing_Coupon_Detail GetByMarketingId(int marketingId)
        {
            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);
            adapter.AddParameter("@MarketingId", marketingId);
            var list = adapter.GetList<TB_Marketing_Coupon_Detail>("sp_TB_Marketing_Detail_GetByMarketingId", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit);
            return list.FirstOrDefault();
        }
    }
}
